package cn.com.captureNetPacket.test; 


import lombok.extern.slf4j.Slf4j;

@Slf4j
public class test {

	public static void testaaa(){
		log.info("--------------------------------------- ");
	 
	}
	public static void main(String[] args) {
		arrayTest();
	}
	
	public static void arrayTest(){
		
		log.debug("arrayTest");
		int rate=8;int groupCount=3;
		int[] arraysInt= {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,11};
		int[][] secArrays= oneDimensional2TwoDimensional(arraysInt,rate,groupCount);
		int[] lastarraysInt=new int[arraysInt.length-(groupCount*rate)];
		
		String tem="";
		tem=" 总长度："+arraysInt.length+" 二位数组长度: "+secArrays.length+" 剩余数组长度: "+lastarraysInt.length;
		log.debug("------------------->");
		log.debug(tem);
		for (int i = 0; i < secArrays.length; i++) {
			tem="验证轮数 第:";
			tem=tem+i+" 轮 --->";
			 for (int j = 0; j < rate; j++) {
				 tem=tem+secArrays[i][j]+",";
			}
			 log.debug("--->{}",tem);
		}
		
		tem="";
		//               (源数组，                               源数组开始位置，                                                                     目标数组，目标数组开始位置，复制的长度)
		System.arraycopy(arraysInt, groupCount*rate, lastarraysInt, 0, arraysInt.length-(groupCount*rate));
		for (int i = 0; i < lastarraysInt.length; i++) {
			tem=tem+lastarraysInt[i]+",";
		}
		log.debug("最后一组："+tem);
		
	}
	
	public static int[][] oneDimensional2TwoDimensional(int[] arraysInt,int rate,int groupCount) {
		int[][] secArrays=new int[groupCount][rate];
		for (int i = 0; i < secArrays.length; i++) {
			 for (int j = 0; j < rate; j++) {
				 secArrays[i][j]=arraysInt[(i)*rate+j];
			}
		}
		return secArrays;
	}
	
	
	
	
	
}
